""" please go through the docs before running this scripts """

from twilio.rest import Client

print("\n" + " *****        WELCOME TO AUTOMATED PYTHON CALLING SCRIPT       ***** ")
print(" *****  PLEASE CREATE A TWILIO ACCOUNT BEFORE USING THE SCRIPT ***** ")
print(" *****      TO CREATE TWILIO ACCOUNT GO TO WWW.TWILIO.COM      ***** ")
print(" *****            TYPE 'YES/yes'  IF YOU WANT TO PROCEED       ***** " + '\n')
i = input()
print("\n")


if (i == "YES" or i == "yes"):
    account_sid = input(" ENTER YOUR TWILIO ACCOUNT-SID ")
    auth_token = input(" ENTER YOUR TWILIO AUTH-TOKEN  ")

    client = Client(account_sid, auth_token)

    print("**** press 1 for single phone number    *****")
    print("**** press 2 for multiple phone numbers *****")
    i = int(input())

    if (i == 1):
        print(" ***** PLEASE ENTER RECIEVER's NUMBER **note mention your country code followed by '+' *****")
        number = int(input())
        print(" ***** PLEASE ENTER YOUR AUTOGENERATED NUMBER **note mention your country code followed by '+' *****")
        my_number = int(input())

        call = client.calls.create(
            url='http://demo.twilio.com/docs/voice.xml',
            to=number,
            from_=my_number
        )
        print(" call success ")

    if (i == 2):
        print(" ***** PLEASE ENTER RECIEVER's NUMBER SEPARTED BY SPACE AND FOLLOWED BY + COUNTRY-CODE")
        number = list(int(i) for i in input().strip().split(' '))
        print(" ***** PLEASE ENTER YOUR AUTOGENERATED NUMBER AND FOLLOWED BY + COUNTRY-CODE")
        my_number = int(input())
        for i in number:
            call = client.calls.create(
                url='http://demo.twilio.com/docs/voice.xml',
                to=i,
                from_=my_number
            )
            print(" call success to the number " + str(i))
